<?php

/*
* This script is part of "Myitkyina, BBCode-Ready Free/Libre Project Web Hosting Application Form For Popular PHP Forums" 
* Download and more info: http://www.mybehs.org/wiki/MyBEHS:Scripts
* Code maintainer : Victor San Kho Lin<victorlin21@gmail.com>
* Code contributers : {ok list yours here}


    Myitkyina, BBCode-Ready Free/Libre Project Web Hosting Application Form For Popular PHP Forums
    Copyright (C) 2007  Victor San Kho Lin

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/** 
* function bigboxotext 
* 
* bigboxotext is a conversion script that allows you to retain your formatting and
* text characters without being penalised by standards on output (xhtml 1.1 validation) and
* allows you to store your textareas content in a mysql database without the fear of loosing formatting.
* 
* <code>
* <?php  // using type 1
*   $textarea = $_POST['textareasfieldname'];
* 	$textarea = $bigboxotext($output;
* ?> 
* </code> 
* 
* @author Chris McKee <pcdevils@gmail.com>  
* 
* @param  string $output - Text Area to be formatted
*/ 

function bigboxotext($output)

{
$output = str_replace(chr(10), "<br />", $output);
$output = str_replace(chr(146), "&#8217;", $output);
$output = str_replace(chr(130), "&#8218;", $output);
$output = str_replace(chr(133), "&#8230;", $output);
$output = str_replace(chr(150), "&ndash;", $output); 
$output = str_replace(chr(151), "&ndash;", $output); 
$output = str_replace(chr(152), "&ndash;", $output);
$output = str_replace(chr(146), "&#39;", $output); // error 146
$output = str_replace("'", "&#39;", $output); // error 146
$output = str_replace(chr(145), "&#39;;", $output); // error 145 
$output = str_replace(chr(147), '"', $output);
$output = str_replace(chr(148), '"', $output); 
$output = str_replace(chr(151), "&#8212", $output);
return $output;
}



?>